package org.apache.cordova;

import android.content.Context;
import android.os.Environment;
import android.util.Log;

import java.io.File;

public class FileManager {



    public static String getFilePath(){
        String path = MainApplication.getContent().getFilesDir().getPath()+"/ionic";
        makeRootDirectory(path);
//        File file =  Environment.getExternalStorageDirectory();
//        String path = file.getPath()+"/ionic";
        getwwwPath();
        return path;
    }


    public static String getwwwPath(){
        String path = MainApplication.getContent().getFilesDir().getPath()+"/ionic/www";
        makeRootDirectory(path);
//        File file =  Environment.getExternalStorageDirectory();
//        String path = file.getPath()+"/ionic";
        makeRootDirectory(path);
        return path;
    }

    // 生成文件夹
    public static void makeRootDirectory(String filePath) {
        File file = null;
        try {
            file = new File(filePath);
            if (!file.exists()) {
                file.mkdir();
            }
        } catch (Exception e) {
            e.printStackTrace();
            Log.e("err",e.getMessage());
        }
    }

}
